<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<!--#include file="includes/getBrowse.aspx"-->
<script  runat="server">
Dim strData As String=""
Dim strConn As String=""
Dim selecttype As String =""
Dim ID As String=""
Sub Page_Load(sender As Object, e As EventArgs)	
	dim strWhere ="",strShow="",strSQL=""
	selecttype=request.QueryString("type")
	if selecttype="" then selecttype="classese"
	ID=request.QueryString("id")	
	if ID="" then ID="BOK"
	if selecttype<>"" and  instr("subject,classese,groups,category,subcategory",selecttype)>0 then
	   select case selecttype
	      	case "subject"
			strSQL="select SubjectID as ID, SubjectName"
			strSQL +=  " as Name from tblSubjects"
			strShow="browsesubject.aspx?type=classese"				
		case "classese"
			strSQL="select ClassID as ID, ClassName  as "
			strSQL +=  "Name from tblClasses"
			strShow="browsesubject.aspx?type=groups"
			strWhere +=  " where SubjectID='" & ID & "'"
		case "groups"
			strSQL="select GroupID as ID, GroupName "
			strSQL  += " as Name from tblGroups"
			strShow="browsesubject.aspx?type=category"
			strWhere +=  " where ClassID='" & ID & "'"
		case "category"
			strSQL="select CateID as ID,CateName as "
			strSQL  += " Name from tblCategories"
			strShow="browsesubject.aspx?type=subcategory"
			strWhere +=  " where GroupID='" & ID & "'"
		case "subcategory"
			strSQL="select SubCateID as ID,SubCateName "
			strSQL += " as Name from tblSubCategories"
			strShow="alphabet.aspx?type=subcategory"
			strWhere +=  " where CateID='" & ID & "'"
		case else
			strSQL="select SubCateID as ID,SubCateName" 
			strSQL += " as Name from tblSubCategories"
			strShow="alphabet.aspx?type=subcategory"
			selecttype="subcategory"
			strWhere +=  " where CateID='" & ID & "'"
		end select
	else
		strSQL="select SubCateID as ID,SubCateName "
		strSQL +=  "as Name from tblSubCategories"
		strSQL="select SubCateID as ID,SubCateName as"
		strSQL += " Name from tblSubCategories"
		strShow="alphabet.aspx?type=subcategory"
		strWhere +=  " where CateID='" & ID & "'"
		selecttype="subcategory"
	end if		
	strSQL +=  strWhere	
Try	
	strConn=ConfigurationSettings.appSettings("conn")
	Dim myConn As SqlConnection  = _
	New SqlConnection(strConn)
	myConn.Open		
	Dim myCom As SqlCommand = _
	New SqlCommand(strSQL,myConn)
	Dim myReader As SqlDataReader = _
	myCom.ExecuteReader()
	Dim li=0
	strData="<td  vAlign=top>"
    	While myReader.Read()
		li+=1
		if li =20 then strData +="</td><td  vAlign=top>"
		strData += "<a href='" + strShow + "&id=" & _
		myReader("ID").toString() + "&name=" & _
		myReader("Name").toString()  & _
		"'>" + myReader.GetString(1) + "</a><br>"
	End While
	strData +="</td>"
	myReader.Close
	myConn.Close
Catch objError As Exception
	strData = "<b>* Error</b>: " & _
	objError.Message & "<p />"
End Try
End Sub
</script>	
<HTML><HEAD><TITLE>InterShop-Online Shopping</TITLE>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<META content=""  name=description>
<META content="trading software platform" name=keywords>
<META http-equiv=Pragma content=no-cache>
<LINK href="style.css" type=text/css rel=stylesheet>
<SCRIPT language=JavaScript>
        	self.defaultStatus = "Online-Shopping!";                           
</SCRIPT>
</HEAD>
<BODY bottomMargin=0 leftMargin=0 topMargin=0  rightMargin=0 marginheight="0"  marginwidth="0">
<!--#include file="top.aspx"-->
<TABLE cellSpacing=0 cellPadding=0 border=0  width="775" >
  <TBODY> 
  <TR>
    <TD vAlign=top  width="160"> 
      <table width="18%" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr> 
          <td align="center"><br>
            <table border=0 cellspacing=0 cellpadding=0>
              <tr valign=bottom align=center> 
                <td><img src="images/web-search.gif" height="19" width="155"></td>
              </tr>
              <tr valign=top align=center> 
                <td> 
                  <table border=0 width=155 cellpadding=1 cellspacing=0 bgcolor=#708090 >
                    <tr> 
                      <td width=100% > 
                        <table width=100% border=0 cellpadding=4 cellspacing=0 bgcolor=#FFFFFF>
                          <tr> 
                            <td valign=top width=8% align="left" bgcolor="#CAE2F0"> 
                              <input size=15  onFocus="this.value = '';" value="Keyword" name=txtKeyword2 class=textbox>
                              <img height=21 
            alt="Click here to search the Item." 
            src="images/go-button.gif" 
            width=21 align=absMiddle 
      border=0> <br>
                              <img src="images/powered-by-google.gif" width="95" height="14"> 
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
            </table>
      </table>
      <table width="18%" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr> 
          <td align="center"><br>
            <table border=0 cellspacing=0 cellpadding=0>
              <tr valign=bottom align=center> 
                <td><img src="images/browse-items.gif" width="155" height="19"></td>
              </tr>
              <tr valign=top align=center> 
                <td> 
                  <table border=0 width=155 cellpadding=1 cellspacing=0 bgcolor=#708090 >
                    <tr> 
                      <td width=100% height="49"> 
                        <table width=100% border=0 cellpadding=4 cellspacing=0 bgcolor=#FFFFFF>
                          <tr> 
                            <td valign=top width=8% align="left" height="51" bgcolor="#CAE2F0"> 
                              <!--#include file="includes/listsubcategories.htm"-->
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
            </table>
      </table>
      <!--#include file="left.aspx"-->
    </TD>
    <TD class=margin width="1" valign="top" align="right" bgcolor="#666666"  > 
    </TD>
    <TD class=text_normal id=mainContent vAlign=top width="420"> 
      <TABLE cellSpacing=4 cellPadding=4 width="100%" align=left border=0 height="61">
        <TR> 
          <TD vAlign=top align=left> 
            <!--#include file="submenu.aspx"-->
	<%=getBrowse(selecttype,ID,strConn)%>	
            <br><img src="images/listitem.gif">
	<br>	
          </TD>
        </TR>
        <TBODY> 
        <TR> 
          <TD vAlign=top align=left height="207"> 
	<table border=0><tr>
	<%=strData%>
	</tr></table>
          </TD>
        </TR>
        </TBODY> 
      </TABLE>
    </TD>
    <TD class=margin width="1" valign="top" align="right" bgcolor="#666666" > 
    </TD>
    <TD class=margin valign="top" align="center" width="160"> 
      <TABLE>
       
	<tr><td>&nbsp;</td><td valign=top>
	  <!--#include file="includes/right-next.htm" --></td></tr>
	   
        <tr>
          <td>&nbsp;</td>
          <td valign=top> <br>
            <table width="18%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td align="center"> 
                  <table border=0 cellspacing=0 cellpadding=0>
                    <tr valign=bottom align=center> 
                      <td><img src="images/bestseller-products.gif" width="155" height="19"></td>
                    </tr>
                    <tr valign=top align=center> 
                      <td> 
                        <table border=0 width=155 cellpadding=1 cellspacing=0 bgcolor=#708090 >
                          <tr> 
                            <td width=100% valign="top"> 
                              <table width=100% border=0 cellpadding=4 cellspacing=0 bgcolor=#FFFFFF>
                                <tr> 
                                  <td valign=top width=8% align="left" height="52"> 
                                    <p>&nbsp;</p>
                                  </td>
                                  <td valign=top width=92% align="left"> 
                                    <!--#include file="includes/right-bestsellers.htm" -->
                                  </td>
                                </tr>
                              </table>
                            </td>
                          </tr>
                        </table>
                  </table>
            </table>
          </td>
        </tr>
      </TABLE>
    </TD>
  </TR></TBODY></TABLE>
  <!--#include file="bottom.aspx"-->
</BODY></HTML>
